cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(recipe-05 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenMP REQUIRED)                                   # 找到库

# 调试
include(CMakePrintHelpers)
#所有属性都有 INTERFACE_ 前缀， 因为这些属性对所需目标， 需要以接口形式提供， 并且目标以接口的方式使用OpenMP。
cmake_print_properties(TARGETS OpenMP::OpenMP_CXX PROPERTIES
        INTERFACE_COMPILE_OPTIONS
        INTERFACE_INCLUDE_DIRECTORIES
        INTERFACE_LINK_LIBRARIES)

add_executable(example example.cpp)
target_link_libraries(example PUBLIC OpenMP::OpenMP_CXX)